<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //ES5继承
        // function fn(a, b) {
        //     this.a = a;
        //     this.b = b;
        // }
        // fn.prototype.call = function() {
        //     console.log('abc');
        // }

        // function fn2(a, b, c, d) {
        //     fn.call(this, a, b);
        //     this.c = c;
        //     this.d = d;
        // }
        // fn2.prototype = new fn();
        // fn2.prototype.constructor = fn2;
        //ES6类继承
        class fn {
            //构造方法
            constructor(a, b) {
                    this.a = a;
                    this.b = b;
                }
                //父类成员属性
            call() {
                console.log('cccc')
            }
        }
        class fn2 extends fn {
            constructor(a, b, c, d) {
                super(a, b) //fn.call(this.a,b)
                this.c = c;
                this.d = d;
            }
            m() {
                console.log('aaaa');
            }
            call() {
                super.call();
                console.log('aaa'); //可以对父类的方法进行重写，字类是不可以直接调用父类的同名方法的,可以使用super.来调用       
            }
        }
    </script>
</body>

</html>